package com.fjh.springboot_01.service.impl;

import com.fjh.springboot_01.mapper.FeedbackMapper;
import com.fjh.springboot_01.pojo.Feedback;
import com.fjh.springboot_01.service.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FeedbackServiceImpl implements FeedbackService {
    
    @Autowired
    private FeedbackMapper feedbackMapper;
    
    @Override
    public void addFeedback(Feedback feedback) {
        feedbackMapper.add(feedback);
    }
    
    @Override
    public List<Feedback> getFeedbacksByUserId(Integer userId) {
        return feedbackMapper.findByUserId(userId);
    }
    
    @Override
    public List<Feedback> getAllFeedbacks() {
        return feedbackMapper.findAll();
    }
    
    @Override
    public Feedback getFeedbackById(Integer id) {
        return feedbackMapper.findById(id);
    }
    
    @Override
    public void replyFeedback(Feedback feedback) {
        feedbackMapper.reply(feedback);
    }
    
    @Override
    public void deleteFeedback(Integer id) {
        feedbackMapper.deleteById(id);
    }
} 